package com.day1;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/s1")
public class Servlet1 extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.service(req, resp);
        resp.getWriter().print("=========这是servlet1");
        HttpSession session = req.getSession();
        session.setAttribute("session","sessionvalue");
        session.setAttribute("session","newsessionvalue");
        //移除
        session.removeAttribute("session");
        //设置延迟时间
        session.setMaxInactiveInterval(10);
    }
}
